package puzzle.nurikabe.solver;

import puzzle.common.data.HatanException;
import puzzle.common.solver.BoardRule;
import puzzle.nurikabe.data.NurikabeBoard;

abstract class NurikabeCellRule implements BoardRule<NurikabeBoard> {

	public boolean apply(NurikabeBoard b) throws HatanException {
		boolean isChanged = false;
		for (int y = 0; y < b.height; y++) {
			for (int x = 0; x < b.width; x++) {
				isChanged |= apply(b, x, y);
			}
		}
		return isChanged;
	}

	abstract protected boolean apply(NurikabeBoard b, int x, int y) throws HatanException;

}
